/*
 * File:   ImageCutterTest.cpp
 * Author: Guilherme Monteiro
 *
 */

#include "ImageCutterTest.h"

CPPUNIT_TEST_SUITE_REGISTRATION(ImageCutterTest);

ImageCutterTest::ImageCutterTest() {
}

ImageCutterTest::~ImageCutterTest() {
}

void ImageCutterTest::setUp() {
    pathValidImg = "../books/mensagem/baixa_resolucao/image99.png";
    validImg = cvLoadImage(pathValidImg.c_str());
    
    pathInvalidImg = "../books/estatisticas/baixa_resolucao/image49.png";
    invalidImg = cvLoadImage(pathInvalidImg.c_str());
}

void ImageCutterTest::tearDown() {
}

void ImageCutterTest::testCutToValidRotatedImage() {
    try {
        ImageCutter* imageCutter = new ImageCutter(validImg, cvPoint(46,55), cvPoint(343,726));
        imageCutter->cut();
    }
    catch(InvalidRectException &ire) {
        CPPUNIT_ASSERT(false);
    }
}

void ImageCutterTest::testCutToInvalidRotatedImage() {
    try {
        ImageCutter* imageCutter = new ImageCutter(invalidImg, cvPoint(18,59), cvPoint(589,287));
        imageCutter->cut();
    }
    catch(InvalidRectException &ire) {
        CPPUNIT_ASSERT(false);
    }
}
